﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace SponsorshipManager.DataAccess
{
    class ProviderTest : IDbProvider
    {
        public string ConnectionString
        {
            get; set;
        }

       

        public int ExecStoredProc(string spName, List<System.Data.IDataParameter> DataParams, string Token)
        {

            int ret;
            switch(spName)
            {
            
                case "uspAuthenticate":
                {

                    IDataParameter param;
                    
                    param= DataParams.Find(p => 
                        p.ParameterName== "UserId"); 
                    if(param != null) param.Value = 1;

                    param = DataParams.Find(p => 
                        p.ParameterName== "Token"); 
                    if(param !=null) param.Value = Guid.NewGuid().ToString();
                    ret = 1;
                    break;
                }

                default:
                {
                    ret = 0;
                    break;
                }
            }

            return ret;
        }

        public int ExecStoredProc(string spName, List<System.Data.IDataParameter> DataParams, out System.Data.DataTable result, string Token)
        {
            switch (spName) 
            { 
                case "uspGetUser":
                    {

                        

                        break;
                    }

                default:
                    {
                        break;
                    }

            
            }
            throw new NotImplementedException();
        }

        public System.Data.IDataAdapter DataAdapter()
        {
            throw new NotImplementedException();
        }

        public System.Data.IDataReader DataReader()
        {
            throw new NotImplementedException();
        }

        public System.Data.IDataParameter Parameter()
        {
            return (IDataParameter)new TestParameter();
            
        }

        public bool Connected
        {
            get ; set; 
        }

        public bool PersistConnections
        {
            get ; 
            set ;
        }
    }
}
